package com.bkd.dreams.client.event;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.bkd.dreams.client.volunteer.Volunteer;

public class VolunteerEventDTO implements Serializable {
	
	private String key;
	private String name;
	private Date date;
	private List<String> volunteers;
	
	public VolunteerEventDTO() {
	}
	
	public VolunteerEventDTO(String name, Date date) {
		this.name = name;
		this.date = date;
	}
	
	public VolunteerEventDTO(VolunteerEvent event) {
		this.name = event.getName();
		this.date = event.getDate();
		this.key = event.getKey();
		this.volunteers = new ArrayList<String>(event.getVolunteers());
	}
	
	public String getKey() {
		return this.key;
	}
	
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Date getDate() {
		return this.date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	
	public void addVolunteer(Volunteer vol) {
		if(this.volunteers == null) {
			this.volunteers = new ArrayList<String>();
		}
		this.volunteers.add(vol.getKey());
	}
	
	public void setVolunteers(List<String> volunteers) {
		this.volunteers = volunteers;
	}
	
	public List<String> getVolunteers() {
		return this.volunteers;
	}
	
	@Override
	public boolean equals(Object obj) {
		boolean result = false;
		if (obj != null && obj.getClass() == getClass()) {
			VolunteerEventDTO other = (VolunteerEventDTO)obj;
			if (other.getName().equals(getName()) && other.getDate().equals(getDate())) {
				result = true;
			}
		}
		return result;
	}
	@Override
	public int hashCode() {
		return 0;
	}
}
